<style>
    .layui-card {
        margin-bottom: 15px;
        border-radius: 2px;
        background-color: #fff;
        box-shadow: 0 1px 2px 0 rgba(0,0,0,.05);
        width: 95%;
        height: 90%;
        margin-top: 10px;
    }
    .delete-price {
        cursor: pointer;
    }
</style>
<div class="layuimini-container">
    <form id="app-form" class="layui-form layuimini-form">
        <blockquote class="layui-elem-quote">
            套餐的功能组节点在【权限用户】=>【权限角色】处添加和管理
        </blockquote>
        <div class="layui-form-item layui-hide">
            <label class="layui-form-label">应用id</label>
            <div class="layui-input-block">
                <input type="text" name="miniapp_id" class="layui-input" lay-verify="required" placeholder="请输入应用id" value="{$row.miniapp_id|default=''}">
            </div>
        </div>
        <!--<div class="layui-form-item">
            <label class="layui-form-label">组id</label>
            <div class="layui-input-block">
                <input type="text" name="group_id" class="layui-input" lay-verify="required" placeholder="请输入组id" value="{$row.group_id|default=''}">
            </div>
        </div>-->
        <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label">角色组</label>-->
            <!--<div class="layui-input-block">-->
                <!--<select name="group_id" lay-verify="required" data-select="/manage/admin/miniapp/module/group?miniapp_id={$row.miniapp_id}" data-fields="group.id,group.name" data-value="{$row.group_id|default=''}">-->
                <!--</select>-->
            <!--</div>-->
        <!--</div>-->

        <div class="layui-form-item">
            <label class="layui-form-label">套餐名</label>
            <div class="layui-input-block">
                <input type="text" name="name" class="layui-input" lay-verify="required" placeholder="请输入功能名" value="{$row.name|default=''}">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">套餐功能组</label>
            <div class="layui-input-block">
                <div id="roles" class="demo-tree"></div>
                <input id="group_id" name="group_id" class="layui-input" lay-verify="required" placeholder="请选择功能组" type="hidden" value="{$row.group_id|default=''}" >
            </div>
        </div>



        <!--<div class="layui-form-item">-->
            <!--<label class="layui-form-label">类型</label>-->
            <!--<div class="layui-input-block">-->
                <!--{foreach $getTypeList as $k=>$v}-->
                <!--<input type="radio" name="type" value="{$k}" lay-filter="type" title="{$v}" {in name="k" value="$row.type"}checked=""{/in}>-->
                <!--{/foreach}-->
            <!--</div>-->
        <!--</div>-->
        <input name="type" class="layui-input" lay-verify="required"  type="hidden" value="{$row.type|default='1'}" >

        <div class="layui-form-item">
            <label class="layui-form-label">套餐规格</label>
            <div class="layui-input-block">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-block">
                <div class="layui-bg-gray" style="padding: 30px;">
                    <div class="layui-row layui-col-space15">
                        <input type="hidden" name="price_json" id="price_json" class="layui-input" lay-verify="required" placeholder="请添加价格" value="{$row.price_json|default=''}">
                        <div class="layui-col-md12">
                            <div class="layui-row layui-col-space11"  id="set_price">
                            </div>
                        </div>
                        <div class="layui-col-md12">
                            <button type="button" class="layui-btn layui-btn-normal layui-btn-radius" id="add_price"><i class="layui-icon">添加价格</i></button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">描述</label>
            <div class="layui-input-block">
                <input type="text" name="desc" class="layui-input"  placeholder="请输入描述" value="{$row.desc|default=''}">
            </div>
        </div>
        <div class="hr-line"></div>
        <div class="layui-form-item text-center">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit>确认</button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">重置</button>
        </div>

    </form>
</div>
<script id="price_template" type="text/html">
    {{#  layui.each(d, function(index, item){ }}
    <div class="layui-col-md4" >
        <div class="layui-card">
            <div class="layui-card-header layui-bg-red delete-price" title="单击移除该规格">点击移除规格</div>
            <div class="layui-card-body">

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">规格名</label>
                        <div class="layui-input-inline">
                            <input type="text" name="title[]" lay-verify="required" placeholder="请输入规格名" autocomplete="off" class="layui-input price-change" value="{{item.title}}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">套餐天数</label>
                        <div class="layui-input-inline">
                            <input type="number" name="day[]" lay-verify="required" placeholder="请输入天数(0为永久)" autocomplete="off" class="layui-input price-change" value="{{item.day}}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">套餐价格</label>
                        <div class="layui-input-inline">
                            <input type="number" name="price[]" lay-verify="required" placeholder="请输入价格" autocomplete="off" class="layui-input price-change" value="{{item.price}}">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">权重</label>
                        <div class="layui-input-inline">
                            <input type="text" name="weight[]"  placeholder="权重越高越靠前" autocomplete="off" class="layui-input price-change" value="{{item.weight?item.weight:0}}">
                        </div>
                    </div>
                </div>


            </div>
        </div>
    </div>
    {{#  }); }}
</script>
<script>
    var id = {$row.id|default=0};
    var miniapp_id = {$row.miniapp_id|default=0};
    var price_json = {$row.price_json|raw|default='[]'};
</script>